#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
const int N = 10;

void solve() {
	int n; cin >> n;
	string a, b; cin >> a >> b;
	ll x = 0, y = 0;
	for (int i = 0; i < a.size(); i++) {
		if (a[i] == '0' && b[i] == '1') {
			x++;
		}
		if (a[i] == '1' && b[i] == '0') {
			y++;
		}
	}
	cout << max(x, y) << endl;
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t; cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}